home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Learn Microsoft Visual Basic 6.0 Now
/
Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO
/
media
/
chap01
/
b01d030.cc2
< prev
next >
Wrap
Text File
|
1998-06-07
|
2KB
|
44 lines
0, Okay, we're ready to run our Lucky Seven
3, program in the Visual Basic programming
5, environment. Before we actually run the
7, application, we may want to go down to
9, the Form Layout Window and drag the tiny
11, icon inside the monitor to the middle
12, of the screen. That will display our
14, window in the center of the screen when the
16, program runs. When you're ready to run
18, your program, you want to click the Start
21, button on the Visual Basic toolbar.
24, When you click the Start button, the
25, program runs in the Visual Basic programming
27, environment. To start our program, we'll
29, click the Spin button and bingo! A seven
32, appears in the first spinner window,
33, and we have a stack of coins announcing a
35, winner. The next time we click, the
37, seven appears in the third window and we
39, win. The next time, it's in the second
41, window, and we win. And then, it's in the
44, first window again, and then, in the
46, second window. You can see that we won a
49, bunch of times at first, although the actual
51, win rate is only 29%. And if we keep
54, going, we'll win sometimes and we'll lose
57, sometimes. When we're ready to stop
59, playing, we'll click the End button to stop
62, the program. Now, if we'd like to change
65, the numbers that appear each time in the
66, Lucky Seven program, in other words, if
68, we'd like to have a new set of random
70, numbers every time, we can open the
73, Form_Load event procedure in the Code window,
76, type the Randomize function, and run
82, the program again. This time, it's a
85, completely random set of spins. And we're not
88, sure exactly what we're going to get.
91, If we run it again, we'll have another
95, set of random numbers. The actual win rate
98, of this program is about 29%. And when
101, we're finished, we'll click the End
102, button to close.
105, END